<!-- 备注 -->
<template>
	<a-modal title="备注" :width="800" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
		@cancel="handleCancel">

		<a-card :bordered="false">
			<div class="table-page-search-wrapper">
				<a-form layout="inline">
					<a-row :gutter="48">

						<a-col :md="24" :sm="24">
							<a-form-item label="备注">
								<a-textarea :auto-size="{ minRows: 6, maxRows: 6 }" maxlength="200" v-model="queryParam.scckRemark"
									placeholder="请输入备注" />
							</a-form-item>
						</a-col>
					</a-row>
				</a-form>
			</div>
		</a-card>


	</a-modal>
</template>

<script>
import { addScckRemark } from '@/api/modular/main/emsorder/emsOrderManage'
export default {
	data() {
		return {
			queryParam: {
				scckRemark: null,
				orderId: null
			}, // 查询参数
			visible: false,
			confirmLoading: false,
			materialType: null
		}
	},
	methods: {
		show(record, materialType) {
			this.visible = true
			// this.queryParam.scckRemark = null;
			switch (materialType) {
				case this.$businessEnum.MATERIAL_TYPE_ENUM.material.id:
					this.queryParam.scckRemark = record.ylScckRemark
					break;
				case this.$businessEnum.MATERIAL_TYPE_ENUM.customized.id:
					this.queryParam.scckRemark = record.dzlScckRemark
					break;
				case this.$businessEnum.MATERIAL_TYPE_ENUM.cable.id:
					this.queryParam.scckRemark = record.xlScckRemark
					break;
				default:
					break;
			}
			this.queryParam.orderId = record.orderId
			this.materialType = materialType
		},

		handleSubmit() {
			this.confirmLoading = true;
			addScckRemark({
				...this.queryParam,
				materialType: this.materialType
			}).then(res => {
				console.log(res);
				this.$message.success('备注添加成功!');
				this.confirmLoading = false;
				this.visible = false;
				this.$emit('ok');
			})
		},
		handleCancel() {
			this.visible = false
		}
	}
}
</script>